package org.luxor.common.netty.protocol.message;


import org.luxor.common.netty.protocol.NettyFixedHeader;

/**
 * Netty 消息定义
 *
 * @author Mr.yan @date 2024/1/31
 */
public class NettyMessage {

    /**
     * 固定消息头
     */
    private final NettyFixedHeader fixedHeader;

    /**
     * 可变消息头
     */
    private final Object variableHeader;

    /**
     * 有效负载
     */
    private final Object payload;

    public NettyMessage(NettyFixedHeader fixedHeader, Object variableHeader, Object payload) {
        this.fixedHeader = fixedHeader;
        this.variableHeader = variableHeader;
        this.payload = payload;
    }

    public NettyFixedHeader fixedHeader() {
        return fixedHeader;
    }

    public Object variableHeader() {
        return variableHeader;
    }

    public Object payload() {
        return payload;
    }

    @Override
    public String toString() {
        return "NettyMessage{" +
                "fixedHeader=" + fixedHeader +
                ", variableHeader=" + variableHeader +
                ", payload=" + payload +
                '}';
    }
}
